class AlarmRecordController < ApplicationController

 def index
    session[:index_page] = params[:page] == nil ? nil : params[:page]
    @filterrific = initialize_filterrific(AlarmRecord,params[:filterrific]) or return
    @alarm_data = @filterrific.find.page(params[:page]).order(created_at: :desc)
 end

 def destroy
     ref = AlarmRecord.find(params[:id])
     ref.status="已审核"
     ref.check_person=session[:login]
     ref.save
     notice='审核成功'  
     redirect_to  alarm_record_index_path, notice: notice
 end
 
 def alarm_ajax 
     a=params[:a]
     hotels = AlarmRecord.find(a)
     aa= {'created_at'=>hotels.created_at.strftime("%Y-%m-%d %H:%M:%S"),'address'=>hotels.address,'message'=>hotels.message}.to_json.to_s
     render text:aa
 end


end
